package com.study.controller;

import com.study.pojo.resp.ResultMessage;
import com.study.service.XwenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

//意识形态控制器
@RestController
@RequestMapping("/xwen")
public class XwenController {
    @Autowired
    XwenService xwenService;
    //查询所有新闻
    @RequestMapping("/findAll")
    public ResultMessage findAll(){
        ResultMessage allNews = xwenService.findAllNews();
        return allNews;
    }

    //根据新闻Id获取新闻
    @RequestMapping("/findNewsById/{newsId}")
    public ResultMessage findNewsById(@PathVariable("newsId")Integer newsId){
        return xwenService.findNewsById(newsId);
    }

    //根据新闻id获取新闻标题列表
    @RequestMapping("/findTitle")
    public ResultMessage findTitle(){
        return xwenService.findAllNews();
    }


}
